package main

import (
	"fmt"
	"math/rand"
	"time"
)

func number1() {
	var width int
	for i := 1; i <= 9; i++ {
		for j := 1; j <= i; j++ {
			if j == 1 {
				width = 2
			} else {
				width = 3
			}
			fmt.Printf("%d*%d=%-[4]*[3]d", j, i, i*j, width)
		}
		fmt.Printf("\n")
	}
	fmt.Println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")

}

func number2() {
	var sum uint16
	var multip uint32 = 1
	src := rand.NewSource(100)
	rand.New(rand.NewSource(time.Now().UnixNano()))
	r10 := rand.New(src)
	for i := 1; i <= 20; i++ {
		fmt.Println(r10.Intn(20) + 1)
		if i&1 == 0 {
			sum += uint16(r10.Intn(20) + 1)
		} else {
			multip *= uint32(r10.Intn(20) + 1)
		}
	}
	fmt.Printf("sum=%d,multip=%d\n", sum, multip)
	fmt.Println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")

}

func number3() {
	var a = 1
	var b = 1
	const NUMBER = 100
	fmt.Println(a)
	fmt.Println(b)
	for {
		b, a = a+b, b
		if b >= NUMBER {
			break
		}
		fmt.Println(b)
	}
}

func main() {
	number1()
	number2()
	number3()
}
